#ifndef SDBAD_H
#define SDBAD_H

#include <vector>
#include <set>
#include <math.h>
#include <iostream>
#include "../src/chipmunk.h"
#include "sdObject.h"
#include "sdTimed.h"

class sdBad : public sdObject {
private:
    int hp_;
    
   	sdObject* target_;

	//TODO: THRUSTER/BOOSTER VARIABLES, LIKE ABOVE
	cpFloat deltaW_; //Turning speed, actually a factor(see implementation)
	cpFloat forwardsForce_; //How strong the thrusters are in a given direction
	cpFloat reverseForce_;
	cpFloat leftForce_;
    cpFloat rightForce_;

public:
    inline sdBad(int hp, cpFloat velocity, cpFloat turn, cpVect pos) : sdObject(cpBodyNew(0, 0)), hp_(hp), target_(NULL) {
        setMass(10.0);
        getBody().p = pos;
    	
    	setDeltaW(turn);
    	setForwardsForce(velocity);

    	addCircleShape(0.0, 20.0, cpvzero, 3);
    }
   
    void draw();
    //virtual void collide;
    
    //TODO: SHIP METHODS, SEE ABOVE
    void move(const cpVect& direction); //direction of force, amp 1.0 is full in that direction
    void turn(const cpVect& direction); //turn to face this direction at speed
    void follow(); //Use ai to attempt to collide with target
    
    void getChunks(std::set<sdTimed*>* chunks);
    
    inline void takeDamage(int damage) {hp_ -= damage;}
    inline int getHp() {return hp_;}
    inline bool dead() {return hp_ <= 0;}
    
    inline void setTarget(sdObject* target) {target_ = target;}
    inline sdObject* getTarget() {return target_;}
          
    //TODO: THRUSTER/BOOSTER OBJECT METHODS, INSIDE SHIP
    inline void setDeltaW(cpFloat deltaW) {deltaW_ = deltaW;}
    inline cpFloat getDeltaW() {return deltaW_;}
    
 	inline void setForwardsForce(cpFloat forwardsForce) {forwardsForce_ = forwardsForce;}
	inline cpFloat getForwardsForce() {return forwardsForce_;}
	
	inline void setReverseForce(cpFloat reverseForce) {reverseForce_ = reverseForce;}
	inline cpFloat getReverseForce() {return reverseForce_;}
	
	inline void setLeftForce(cpFloat leftForce) {leftForce_ = leftForce;}
	inline cpFloat getLeftForce() {return leftForce_;}
	
	inline void setRightForce(cpFloat rightForce) {rightForce_ = rightForce;}
	inline cpFloat getRightForce() {return rightForce_;}
};

#endif
